.class Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;
.super Ljava/lang/Thread;
.source "ZMDownloadStatusReceiver.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver;->onReceive(Landroid/content/Context;Landroid/content/Intent;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver;

.field final synthetic val$mContext:Landroid/content/Context;

.field final synthetic val$mHandler:Landroid/os/Handler;

.field final synthetic val$packageName:Ljava/lang/String;


# direct methods
.method constructor <init>(Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver;Landroid/content/Context;Ljava/lang/String;Landroid/os/Handler;)V
    .registers 5
    .param p1, "this$0"    # Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver;

    .prologue
    .line 32
    iput-object p1, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->this$0:Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver;

    iput-object p2, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$mContext:Landroid/content/Context;

    iput-object p3, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$packageName:Ljava/lang/String;

    iput-object p4, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$mHandler:Landroid/os/Handler;

    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .registers 16

    .prologue
    .line 36
    new-instance v9, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;

    invoke-direct {v9}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;-><init>()V

    .line 37
    .local v9, "query":Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;
    new-instance v6, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;

    iget-object v12, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$mContext:Landroid/content/Context;

    iget-object v13, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$mContext:Landroid/content/Context;

    invoke-virtual {v13}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v13

    iget-object v14, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$mContext:Landroid/content/Context;

    invoke-virtual {v14}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v14

    invoke-direct {v6, v12, v13, v14}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;-><init>(Landroid/content/Context;Landroid/content/ContentResolver;Ljava/lang/String;)V

    .line 38
    .local v6, "mDownloadManager":Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;
    const/4 v0, 0x0

    .line 40
    .local v0, "c":Landroid/database/Cursor;
    :try_start_19
    invoke-virtual {v6, v9}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;->query(Lcom/zuimeia/sdk/download/providers/ZMDownloadManager$Query;)Landroid/database/Cursor;

    move-result-object v0

    .line 41
    :cond_1d
    :goto_1d
    invoke-interface {v0}, Landroid/database/Cursor;->moveToNext()Z
    :try_end_20
    .catch Ljava/lang/Throwable; {:try_start_19 .. :try_end_20} :catch_c0
    .catchall {:try_start_19 .. :try_end_20} :catchall_c7

    move-result v12

    if-eqz v12, :cond_ba

    .line 43
    :try_start_23
    const-string v12, "apk_package_name"

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v12

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v1

    .line 44
    .local v1, "dbPackageName":Ljava/lang/String;
    iget-object v12, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$packageName:Ljava/lang/String;

    invoke-virtual {v1, v12}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v12

    if-eqz v12, :cond_1d

    .line 45
    const-string v12, "_id"

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v12

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v2

    .line 46
    .local v2, "downId":J
    const-string v12, "title"

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v12

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v11

    .line 47
    .local v11, "title":Ljava/lang/String;
    const-string v12, "is_need_post_data"

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v12

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v5

    .line 48
    .local v5, "isNeedPostData":Ljava/lang/String;
    const-string v12, "local_uri"

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v12

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v12

    const-string v13, "file://"

    const-string v14, ""

    invoke-virtual {v12, v13, v14}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;

    move-result-object v4

    .line 49
    .local v4, "filePath":Ljava/lang/String;
    const-string v12, "primary_key"

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v12

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v8

    .line 50
    .local v8, "primaryKey":Ljava/lang/String;
    const-string v12, "other_key"

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v12

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v7

    .line 51
    .local v7, "otherKey":Ljava/lang/String;
    const-string v12, "status"

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v12

    invoke-interface {v0, v12}, Landroid/database/Cursor;->getInt(I)I

    move-result v10

    .line 52
    .local v10, "status":I
    const/16 v12, 0x8

    if-ne v10, v12, :cond_1d

    .line 53
    invoke-static {v4}, Lcom/zuimeia/sdk/download/utils/AppIOUtil;->isFileExist(Ljava/lang/String;)Z

    move-result v12

    if-eqz v12, :cond_9a

    .line 54
    invoke-static {v4}, Lcom/zuimeia/sdk/download/utils/AppIOUtil;->deleteFile(Ljava/lang/String;)Z

    .line 55
    iget-object v12, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$mHandler:Landroid/os/Handler;

    new-instance v13, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1$1;

    invoke-direct {v13, p0, v11}, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1$1;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;Ljava/lang/String;)V

    invoke-virtual {v12, v13}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 64
    :cond_9a
    const/4 v12, 0x1

    new-array v12, v12, [J

    const/4 v13, 0x0

    aput-wide v2, v12, v13

    invoke-virtual {v6, v12}, Lcom/zuimeia/sdk/download/providers/ZMDownloadManager;->remove([J)I

    .line 66
    const-string v12, "true"

    invoke-virtual {v5, v12}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v12

    if-eqz v12, :cond_1d

    .line 67
    iget-object v12, p0, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;->val$mHandler:Landroid/os/Handler;

    new-instance v13, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1$2;

    invoke-direct {v13, p0, v8, v7}, Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1$2;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/ZMDownloadStatusReceiver$1;Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v12, v13}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z
    :try_end_b5
    .catch Ljava/lang/Throwable; {:try_start_23 .. :try_end_b5} :catch_b7
    .catchall {:try_start_23 .. :try_end_b5} :catchall_c7

    goto/16 :goto_1d

    .line 78
    .end local v1    # "dbPackageName":Ljava/lang/String;
    .end local v2    # "downId":J
    .end local v4    # "filePath":Ljava/lang/String;
    .end local v5    # "isNeedPostData":Ljava/lang/String;
    .end local v7    # "otherKey":Ljava/lang/String;
    .end local v8    # "primaryKey":Ljava/lang/String;
    .end local v10    # "status":I
    .end local v11    # "title":Ljava/lang/String;
    :catch_b7
    move-exception v12

    goto/16 :goto_1d

    .line 86
    :cond_ba
    if-eqz v0, :cond_bf

    .line 87
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 91
    :cond_bf
    :goto_bf
    return-void

    .line 83
    :catch_c0
    move-exception v12

    .line 86
    if-eqz v0, :cond_bf

    .line 87
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    goto :goto_bf

    .line 86
    :catchall_c7
    move-exception v12

    if-eqz v0, :cond_cd

    .line 87
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    :cond_cd
    throw v12
.end method
